<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_student_read.css" />
<link rel="stylesheet" href="${staticServer}/css/reserve.css"/>
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/core/page_core.js"></script>
<script src="${staticServer}/js/web/reserve.js?1.3"></script>
<script src="${staticServer}/js/web/consultant_client_state.js?1.4"></script>
<script src="${staticServer}/inc/js/model_resp.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/inc/js/htmlfilter.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/tips.js"></script>
<style type="text/css">
#statelist label {
	display: block;
	float: left;
	width: 120px;
}
table tr[class=fields] {
    background: #EFE5EB;
}
table tr[class=fields] th {
    padding-left: 0;
}
table tr[class=fields] th {
    height: 40px;
    line-height: 40px;
    padding-left: 20px;
    background: #EFE5EB;
}
table th,table td {
    padding-left: 10px;
    padding-right: 10px;
    border: 1px solid #D0D0D0;
}
table tr.even_row {
    background: #fcfcfc;
}
table th, table td {
    padding-left: 10px;
    padding-right: 10px;
    border: 1px solid #D0D0D0;
}
table tr>th {
    color: #999;
    font-size: 15px;
    font-weight: bold;
    text-align: right;
}
.caption {
    color: #bbb;
    font-weight: normal;
    font-size: 12px;
    font-style: italic;
}
#statelist label {
    display: block;
    float: left;
    width: 120px;
}
table tr.odd_row {
    background: #f6f6f6;
}
.caption {
    color: #bbb;
    font-weight: normal;
    font-size: 12px;
    font-style: italic;
}
.fields{ 
	position: relative; 
	top:expression(this.offsetParent.scrollTop-2); 
}

</style>
<script>
var selectMsg = function(){
	var nickname = $("#condition").val();
	var btnInvalid = $("#btnInvalid").is(':checked')
	var isBySigned = $("#isBySigned").is(':checked')
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var intention = $("#tip").val();
	var stName = $("#stName").val();
	var stat = $("#stat").val();
	window.location.href=encodeURI("${contextPath}/index/system_client_list.htm?nickname="+nickname+"&btnInvalid="+btnInvalid+"&isBySigned="+isBySigned+"&startTime="+startTime+"&endTime="+endTime+"&intention="+intention+"&state="+stat+"&stName="+stName);
}

var getFollow = function(keyname,id){
	$("#traId").val(id);
	$.post("${contextPath}/index/get_client_follow.json", {
		"keyname":keyname
	}, function(ms) {
		var list = ms.list;
		var objHtml = "";
		$("#trackList"+id).val("");
		if(list!=null){
			var j=list.length+1;
			for(var i=0;i<list.length;i++){
				var state = "";
				if(list[i].state=="" || list[i].state==null){
					state = '<a class="stateitem caption">无变化</a>';
				}else{
					state = '<a class="stateitem">'+list[i].state+'</a>';
				}
				if(list[i].state2=="" || list[i].state2==null){
					state2 = '';
				}else{
					state2 = '<a class="stateitem">'+list[i].state2+'</a>';
				}
				if(list[i].state3=="" || list[i].state3==null){
					state3 = '';
				}else{
					state3 = '<a class="stateitem">'+list[i].state3+'</a>';
				}
				if(list[i].startTime != null){
					remind_date = list[i].startTime;
				}else{
					remind_date = "";
				}				
				objHtml += '<ul>'+
	            			'<li>'+
	            				'<p class="trackingtitle" style="display: block;">第 '+(--j)+' 次跟踪记录<em class="caption">（负责人：'+list[i].nickname+'　日期：'+list[i].createTime+'）</em><a class="btnHidden" onclick="btnShow(this)">点击展开</a></p>'+
	            				'<p class="trackingstate" style="display: block;"><b>客户状态</b><span>'+state+state2+state3+'</span></p>'+
	            				'<p style="display: block;"><b>备注情况</b></p>'+
	            				'<p style="display: block;" id="re" ><b>提醒时间</b><input readonly="readonly" style="margin-left:5px;" value="'+remind_date+'" class="DatePicker_Icon" type="text" name="remind" id="remind" size="15" value="" rel="DATE::Y-m-d" /></p>'+
	            				'<div class="content" style="display: block;">'+list[i].remark+'</div>'+
	            			'</li>'+
	            		'</ul>'
			}
			$("#trackList"+id).html('<a class="stress unit" onclick="remove_tracking()"> 点击隐藏跟踪记录 </a>'+objHtml);
			$("#__TRACKING_LIST"+id).show();
			
		}
		
	});
}
function btnShow(obj){
	 var b = $(obj).siblings('.caption').parent().parent().find('p:not(:first)').visible();
	 var s = $(obj).siblings('.caption').parent().parent().parent().children();
	 var h = $(obj).siblings('.caption').parent();
	 var remind = $(obj).siblings('.caption').parent().parent().find('#remind').val();
	 var sh = null;
	 if(remind!=""){
		 sh = $(obj).siblings('.caption').parent().parent().parent().children().children();
		}else{
		 sh = $(obj).siblings('.caption').parent().parent().parent().children().children().not("#re");
		}	
	 if(b == false){
			 sh.show();
			 s.show();
	 }else{
		 	sh.hide();
		 	h.show();
	 }
	}

var remove_tracking = function(){
	var id = $("#traId").val();
	$("#__TRACKING_LIST"+id).hide();
}

var addFloat = function(keyname){
	$("#keyname").val(keyname);
	$("#__DIV_CLIENT_SELECTOR_MASK").show();
	$("#__DIV_CLIENT_SELECTOR").show();
}

var quxiao = function(){
	$("#__DIV_CLIENT_SELECTOR_MASK").hide();
	$("#__DIV_CLIENT_SELECTOR").hide();
}

function reset(){
		document.getElementById("condition").value="";
		$("#btnInvalid").removeAttr("checked");
		$("#isBySigned").removeAttr("checked");
		document.getElementById("startTime").value="";
		document.getElementById("endTime").value="";
	}

//输入框回车事件
function EnterPress(e){
var e = e || window.event; 
if(e.keyCode == 13){ 
	var total = $("#total").val();
	var page = $("#pages").val();
	var nickname = $("#nick").val();
	var invalid = $("#inva").val();
	var startTime = $("#start").val();
	var endTime = $("#end").val();
	var intention = $("#tip").val();
	var stat = $("#stat").val();
	
	if(page<=total){
		location.href=encodeURI("${contextPath}/index/system_client_list.htm?currPage="+page+"&nickname="+nickname+"&invalid="+invalid+"&startTime="+startTime+"&endTime="+endTime+"&intention="+intention+"&state="+stat);
	}else{
		alert("输入的页数要小于总页数。");
	}
	} 
} 

function mdate(){
 	var nickname = $("#condition").val();
	var btnInvalid = $("#btnInvalid").is(':checked')
	var isBySigned = "mdate";
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var intention = $("#tip").val();
	var stat = $("#stat").val();
	
	location.href=encodeURI("${contextPath}/index/system_client_list.htm?nickname="+nickname+"&btnInvalid="+btnInvalid+"&isBySigned="+isBySigned+"&startTime="+startTime+"&endTime="+endTime+"&intention="+intention+"&state="+stat);
}

function cdate(){
	var nickname = $("#condition").val();
	var btnInvalid = $("#btnInvalid").is(':checked')
	var isBySigned = "cdate";
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var intention = $("#tip").val();
	var stat = $("#stat").val();
	
	location.href=encodeURI("${contextPath}/index/system_client_list.htm?nickname="+nickname+"&btnInvalid="+btnInvalid+"&isBySigned="+isBySigned+"&startTime="+startTime+"&endTime="+endTime+"&intention="+intention+"&state="+stat);
}

function state(stat){
	var nickname = $("#condition").val();

	var btnInvalid = $("#btnInvalid").is(':checked')
	var isBySigned = "cdate";
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var intention = $("#tip").val();
	location.href=encodeURI("${contextPath}/index/system_client_list.htm?nickname="+nickname+"&btnInvalid="+btnInvalid+"&isBySigned="+isBySigned+"&startTime="+startTime+"&endTime="+endTime+"&intention="+intention+"&state="+stat);
}

</script>
</head>

<body>
<input type="hidden" id="keyname" value="">
<input type="hidden" id="traId" value="">
<input type="hidden" id="isBySigned" value="${isBySigned}">

	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>资源统计管理</li>
			<li>&gt;</li>
			<li class="current">客户资源查询</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table class="form_table">
			<tr>
				<td><div style="overflow: hidden;">
						<label><b>查询条件：</b></label>
						<input type="text" id="condition" size="50" value="${nickname}" placeholder="姓名/电话/邮箱/QQ/" /> 
						<label for="btnInvalid"><input type="checkbox" <#if invalid?? && invalid=="true">checked</#if> id="btnInvalid" style="margin-top: 6px;" />过滤无效客户</label> 
					</div>
					<div style="overflow: hidden;">
						<label><b>学员名字：</b></label>
						<input type="text" id="stName" size="50" value="${stname}" placeholder="学员名" /> 
					</div>
					<div style="overflow: hidden;">
						<label for="start_date">起始日期：</label>
						<input type="text" name="start_date" id="startTime" size="15" value="${startTime}" rel="DATE::Y-m-d" /> 
						<label for="end_date">终止日期：</label> 
						<input type="text" name="end_date" id="endTime" size="15" value="${endTime}" rel="DATE::Y-m-d" />
						<input type="button" value=" 查 询 " onclick="selectMsg()" />
						<input type="button" name="button2" onclick="reset()" value=" 重 置 ">
					</div></td>
			</tr>
		</table>
		<table>
			<tr class="fields" style="height: 60px;">
				<th>客户姓名</th>
				<th>所在地</th>
				<th>渠道</th>
				<th>联系方式</th>
				<th>学员</th>
				<th>登记老师</th>
				<th>登记日期</th>
				<th>负责老师</th>
				<th>转交日期</th>
				<!-- <th>操作</th> -->
			</tr>
			<#if list??>
				<#list list as list>
						<td align="center" class="stress">
							<span href="" name="${list.keyname}"  title="" id="icoont173oz7">
								${list.nickname}</span></br><em class="valid"><#if list.invalid=="0">(有效)<#else>(无效)</#if></em>
						</td>
						<td align="center">${list.province}<#if list.city!=''>-${list.city}</#if></td>
						<td align="center">${list.sourcens}</td>
						<td align="center">
						<#if list.phlist??>
							<#list list.phlist as phlist>
							<a title="<#if phlist.phone!="">电话：${phlist.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
							<#assign phone = "${phlist.phone}">
							<#if phlist.name=="爸爸" || phlist.name=="妈妈">
								<em class="caption">电话：</em><br/>${phlist.phone}<br/>
								<em class="caption">关系：</em>${phlist.name}<br/>
							<#elseif phlist.guanxi!="">
								<em class="caption">电话：</em><br/>${phlist.phone}<br/>
								<em class="caption">关系：</em>${phlist.guanxi}<br/>
							<#else>
								<em class="caption">电话：</em><br/>${phlist.phone}<br/>
								<em class="caption">关系：</em>${phlist.name}<br/>
							</#if>
							</a>
     						</#list>
     						<#else>
						<a title="<#if list.phone!="" && list.phone?contains('[]')==false>电话：${list.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
     						<#if list.phone!="" && list.phone?contains('[]')==false>
     						<em class="caption">电话：</em>${list.phone}
     						<#elseif list.qq!="">
     						<em class="caption">QQ:</em>${list.qq}
     						<#elseif list.weixin!="">
     						<em class="caption">微信:</em>${list.weixin}
     						<#elseif list.email!="">
     						<em class="caption">email:</em>${list.email}
     						</#if>
     						</a>
     					  </#if>
     					</td>
     					<td align="center">
						<#if list.student??>
							<#list list.student?split(",") as student>
         						${student}
     						</#list>
     					</#if>
						</td>
						<td align="center" style="width:50px;">${list.rawuser}</td>
						<td align="center"><#if list.modeTime??>${list.modeTime}</#if></td>
						<td align="center"><#if list.ueuser??>${list.ueuser}</#if></td>
						<td align="center"><#if list.dateTime??>${list.dateTime}</#if></td>
					<!--	
						<td align="center">
							<a onclick="getFollow('${list.keyname}','${list.id}')" class="btnSearchTracking">历史跟踪(${list.tracksize})</a>
						</td>
					-->
					</tr>
				
	            <tr id="__TRACKING_LIST${list.id}" style="display:none">
	            	<td colspan="10" class="trackinglst" id="trackList${list.id}">
	            	</td>
	            </tr>
				</#list>
			</#if>
		</table>
	</div>
	<div id="pager">
	<input type="hidden" id="inva" value="${invalid}" />
	<input type="hidden" id="nick" value="${nickname}">
	<input type="hidden" id="start" value="${startTime}" />
	<input type="hidden" id="end" value="${endTime}" />
	<ul id="pagination" style="padding-left: 14px">
		<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
				<#if currpage==1 >
					<li class="previous-off">首页</li>
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/system_client_list.htm?currPage=1&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">首页</a></li>
					<li class="previous"><a href="${contextPath}/index/system_client_list.htm?currPage=${currpage-1}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">上一页</a></li>
					</#if>
					<input type="hidden" id="total" value="${page.pagetotal}" />	
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/system_client_list.htm?currPage=${index_up}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_client_list.htm?currPage=${index_up}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/system_client_list.htm?currPage=${pagetotal}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/system_client_list.htm?currPage=1&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_client_list.htm?currPage=${index_up}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/system_client_list.htm?currPage=${pagetotal}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/system_client_list.htm?currPage=1&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_client_list.htm?currPage=${index_up}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		 	<li class="previous-off">尾页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/system_client_list.htm?currPage=${currpage+1}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">下一页</a></li>
			<li class="previous"><a href="${contextPath}/index/system_client_list.htm?currPage=${page.pagetotal}&nickname=${nickname}&invalid=${invalid}&startTime=${startTime}&endTime=${endTime}&intention=${intention}">尾页</a></li>
		</#if>
		<li class="previous"><input type="text" id="pages" onkeypress="EnterPress(event)" size="10" placeholder="跳转页数" style="line-height: 30px; padding: 0 11px 0 11px;"></li>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul>
	</div>
	<div class="emptyline"></div>

<script>
$(document).ready(function(){
var bh =$(window).height()/2;
var bw =$("body").width()/2;
var h = $("#__DIV_CLIENT_SELECTOR").height()/2;
var w =$("#__DIV_CLIENT_SELECTOR").width()/2;
var mh = bh-h-80;
var mw = bw-w;
  $("#__DIV_CLIENT_SELECTOR").css({"top":mh,"left":mw,"position":"fixed"});
  $("#__DIV_CLIENT_SELECTOR_MASK").css("position","fixed");
});

</script>
	
</body>
</html>